<?php $f = $this->form ?>
<div class="mainpage">
<form method="post" class="form-horizontal" enctype="multipart/form-data">
	<div class="top-tools">
        <?php echo $this->flashMessenger()?>
        <a href="/admin/product/read" class="exit  btn " ><i class="icon-hand-left hint" data-hint-msg="Quay lại"></i></a>

        <div class="pull-right">
            <?php echo $f->getDefaultActionGroup() ?>
        </div>
        <div class="clear"></div>
    </div>

    <div class="row-fluid">
    	<h3 class="form-legend"><?php echo $f->getLegend() ?></h3>
    </div>

    <div class="row-fluid">
        <div class="span12">
            <?php
            echo $f->getElement('product_category_id'),
            $f->getElement('code'),
            $f->getElement('name'),
            $f->getElement('price_original'),
            $f->getElement('price_sale'),
            $f->getElement('price_sale_off'),
            $f->getElement('thumbnail_link');
            ?>

            <div class="control-group">
                <label for="images" class="control-label">Images </label>
                <div class="controls">
                    <input type="file" name="images[]" style="display:block">
                    <input type="file" name="images[]" style="display:block">
                    <input type="file" name="images[]" style="display:block">
                    <input type="file" name="images[]" style="display:block">
                    <input type="file" name="images[]" style="display:block">
                    <input type="file" name="images[]" class="more-images" data-ni="6">
                    <input type="button" class="btn" style="width:auto;margin-top:5px" name="add-more-images" id="add-more-images" value="More images">
                </div>
            </div>


            <?php
            echo $f->getElement('status'),
            $f->getElement('is_new'),
            $f->getElement('is_sale_off'),
            $f->getElement('product_status_id'),
            $f->getElement('product_color_id'),
            $f->getElement('product_size_id'),
            $f->getElement('quantity'),
            $f->getElement('sorting_number'),
            $f->getElement('description'),
            $f->getElement('detail'),
            $f->getElement('meta_keyword'),
            $f->getElement('meta_description'),
            $f->getElement('header_title');
            ?>
            <div class="form-action-group">
                <input type="submit" name="submit" id="submit" value="Save" class="btn btn-primary">
                <input type="reset" name="reset" id="reset" value="Reset" class="btn">
            </div>
        </div>
    </div>

    <div class="clear"></div>
</form>
</div>

<style>
.multi-checkbox {
	float: left;
	margin-right: 10px !important;
}
.more-images {
	display: none !important;
}
</style>

<script>
$(document).ready(function() {
    $('#add-more-images').click(function() {
    	t = $('.more-images');
        datani = parseInt(t.attr('data-ni'));
        if(datani > 10) {
            alert('Max file upload is < 10 file');
            return null;
        }
        t.attr('data-ni', datani + 1);
    	t.clone().removeClass('more-images').removeAttr('data-ni').attr('style', 'display:block').show().insertBefore(t);
        }
    );
});
</script>